"""
__author__ = '霍格沃兹测试开发学社'
__desc__ = '更多测试开发技术探讨，请访问：https://ceshiren.com/t/topic/15860'
"""
from apis.base_api import BaseApi


class Owners(BaseApi):

    def search(self, lastname):
        '''
        通过 lastname 查询宠物主人信息
        '''
        # url = f"https://spring-petclinic-rest.k8s.hogwarts.ceshiren.com/petclinic/api/owners?lastName={lastname}"
        url = f"https://spring-petclinic-rest.poc.ceshiren.com/petclinic/api/owners?lastName={lastname}"
        req = {
            "method": "GET",
            "url": url
        }
        r = self.send_api(req)
        return r

    def add(self, data):
        url = "https://spring-petclinic-rest.poc.ceshiren.com/petclinic/api/owners"
        req = {
            "method": "POST",
            "url": url,
            "json": data
        }
        r = self.send_api(req)
        return r
